//
//  UIImage+colorImage.m
//  AETravel
//
//  Created by carshoel on 16/5/1.
//  Copyright © 2016年 carshoel. All rights reserved.
//

#import "UIImage+colorImage.h"

@implementation UIImage (colorImage)

+(instancetype)imageWithColor:(UIColor *)color{

    //开启上下文
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(30, 30), NO, 0.0);
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    //画图
    [color set];
    CGContextFillRect(ctx, CGRectMake(0, 0, 30, 30));
    //取图
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return [image resizableImageWithCapInsets:UIEdgeInsetsMake(1, 1, 1, 1)];;
}
@end
